<#assign ctx=request.contextPath />
<!DOCTYPE html>
<html>
  <head>
<title>${Func.getMainCompanyJc()?if_exists}管理平台</title>
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/assets/img/ezu.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="${ctx}/assets/css/scojs.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/sco.message.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/form.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/buttons.css" />
<link rel="stylesheet" href="${ctx}/assets/css/gird.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/jquery-labelauty.css"/>
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="${ctx}/assets/css/chosen.min.css">
<style>
.chosen-container{font-size: 14px;min-width: 370px;}
</style>
<style>
	/* autocomplete */
	div.ac {border: 1px solid #ccc;position: absolute;display: none;overflow: auto;background-color: #ffffff;z-index:998;}
	div.ac > ul {margin-top:10px;padding:0;}
	div.ac > ul > li {height:33px;line-height:33px;cursor:pointer;}
	div.ac > ul > li:hover{background:#eee;}
	div.ac > ul > li > div span {padding-left:15px;}
	div.ac > ul > li > div span em {color:red;font-style: normal;}
	.inputTime{
	   height:35px;
	   width:260px;
	   border:1px solid #ccc;
	   border-radius:4px;
	   padding:6px 12px;
	}
		ul { list-style-type: none;}
        .dowebok > li { display: inline-block;}
		.dowebok > li { margin: 10px 0;}
		input.labelauty + label { font: 12px "Microsoft Yahei";}
</style>
<style>
  .in{
     z-index:2;
  }
  .anchorBL{
   display:none;
  }
</style>
  </head>
  <body>
  <div class="container" style="margin-left:5px;">
<div class="tabbable">
	<ul class="nav nav-tabs">
		<@daijia>
			<@shiro.hasPermission name='order'>
				<li <#if default=="daijia">class="active"</#if>><a id="daijiaClick" href="#daijiaTab" data-toggle="tab">代驾订单</a></li>
	    	</@shiro.hasPermission>
	    </@daijia>
	    <@pao>
		    <@shiro.hasPermission name='errand'>
		    	<li <#if default=="errand">class="active"</#if>><a id="errandClick" href="#errandTab" data-toggle="tab">跑腿订单</a></li>
			</@shiro.hasPermission>
		</@pao>
		<@zhuan>
		    <@shiro.hasPermission name='zhuan'>
		    	<li <#if default=="zhuan">class="active"</#if>><a id="zhuanClick" href="#zhuanTab" data-toggle="tab">专车订单</a></li>
			</@shiro.hasPermission>
		</@zhuan>
		<@freight>
			<@shiro.hasPermission name='freight'>
		    	<li <#if default=="freight">class="active"</#if>><a id="freightClick" href="#freightTab" data-toggle="tab">货运订单</a></li>
			</@shiro.hasPermission>
		</@freight>
		<@zhuanxian>
			<@shiro.hasPermission name='zhuanxian'>
		    	<li <#if default=="zhuanxian">class="active"</#if>><a id="zhuanxianClick" href="#zhuanxianTab" data-toggle="tab">快车订单</a></li>
			</@shiro.hasPermission>
		</@zhuanxian>
	</ul>
	<div class="tab-content" style="margin-top:10px;">
		<div class="tab-pane in <#if default=="daijia">active</#if>" id="daijiaTab">
			<div class="row">
				<form id="submit_form" action="${ctx}/order/create" class="form-horizontal" method="post">
					<input type="hidden" name="CSRFToken" value="${CSRFToken}"/>
					<div class="col-md-6">
						<div class="panel panel-default">
						    <div id="allmap" style="z-index: 99999; height:700px;">
			        		
			        		</div>
			        	
			        		<div class="table-responsive">
			        		<table id="memberOrders-table" class="table table-condensed table-bordered" style="display:none;">
								<tr style="font-size:14px;">
									<th>状态</th>
									<th>单号</th>
									<th>类型</th>
									<th>来源</th>
									<th>预约时间</th>
									<th>预约地</th>
								</tr>
							</table>
							</div>
						</div>
					</div>
				
					<div class="col-md-6">
						<div class="panel panel-default">
							<div class="panel-heading">
								输入代驾地点定位，或地图上右击定位
						    </div>
						    <div class="panel-body">
			    				
		    					<input type="hidden" id="longitude" name="longitude">
		    					<input type="hidden" id="latitude" name="latitude">
		    					<input type="hidden" id="toPlaceLongitude" name="toPlaceLongitude">
		    					<input type="hidden" id="toPlaceLatitude" name="toPlaceLatitude">
		    					<input type="hidden" id="fromPlaceDetail" name="fromPlaceDetail">
		    					<input type="hidden" id="toPlaceDetail" name="toPlaceDetail">
		    					
		    					<div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户手机</span>
						            		<input class="form-control" id="clientPhone" name="clientPhone" type="text" value=""  required/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-info" style="font-size:14px;" id="membertype"></span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">客户姓名</span>
						            	<input class="form-control" id="clientName" name="clientName" type="text" value=""/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual">0元</span>
					                </div>
				                </div>
				                  
				                <div id="todayordernums_div" style="display:none;">
					                <div class="form-group">
					                	<div class="col-sm-6">
						                    <label><em>&nbsp;&nbsp;</em>总下单量:</label>
						                    <label>
								            	<p class="form-control-static" id="allcount"></p>
								            </label>
							            </div>
							            <div class="col-sm-6">
						                    <label><em>&nbsp;&nbsp;</em>总实际下单量:</label>
						                    <label>
								            	<p class="form-control-static" id="allnotcancelcount"></p>
								            </label>
							            </div>
					                </div>
					                <div class="form-group">
							            <div class="col-sm-6">
								            <label><em>&nbsp;&nbsp;</em>本月单量:</label>
						                    <label>
								            	<p class="form-control-static" id="monthcount"></p>
								            </label>
							            </div>
							            <div class="col-sm-6">
								            <label><em>&nbsp;&nbsp;</em>本月实际单量:</label>
						                    <label>
								            	<p class="form-control-static" id="monthnotcancelcount"></p>
								            </label>
							            </div>
					                </div>
				                </div>
			               		<div class="form-group">
				                    <div class="col-sm-12" id="couponSelect">
				                    
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon">预约地址</span>
						                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="fromPlace" name="fromPlace" type="text" value="" autocomplete="off" required/>
						                    <span class="input-group-btn">
						                            <button class="btn btn-default" type="button" id="btn-position">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
			                	<div class="form-group">
				                    <div class="col-sm-12">
					                    <div class="input-group">
					                    	<span class="input-group-addon">目的地址</span>
						                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="toPlace" name="toPlace" type="text" value="" autocomplete="off" required/>
						                    <span class="input-group-btn">
						                            <button class="btn btn-default" type="button" id="btn_toPlace">定位</button>
						                    </span>
					                    </div>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                	<div class="col-sm-12">
				                	 	<div class="input-group ">
					                		<span class="input-group-addon" >预约时间</span>
							                <input class="form-control"  id="serverDate" name="serverD" type="text" value="${(.now)?string('yyyy-MM-dd')}" required/>
							            	<div class="input-group-btn" style="width:20%">
							            		<input class="form-control"  id="serverTime" name="serverT" type="text" value="${(.now)?string('HH:mm')}" required/>
							            	</div>
						                </div>
						              </div>
				                </div>
				                
				                <div class="form-group col-sm-12">
				                    <div class="input-group">
				                    	<span class="input-group-addon">服务人员人数</span>
						            	<input class="form-control" id="driverNum" name="driverNum" type="number" value="1" required min="1" max="10"/>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">介绍人</span>
						            	<input placeholder="本单介绍人:某某酒店" class="form-control" id="fromSource" name="fromSource" type="text" value=""/>
					                	</div>
					                </div>
				                </div>
				                
					          	<div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<div class="input-group-addon">所属公司</div>
							            	<select class="form-control" id="companyId" name="companyId"/>
							            		<#list companys as c>
							            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
							            		</#list>
							            	</select>
					                	</div>
					                </div>
				                </div>
				                
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
				                    	<span class="input-group-addon">客户经理</span>
							            	<select class="form-control" id="weixinManagerId" name="weixinManagerId"/>
							            		<!--
							            		<option value="">--无--</option>
							            		<#list weixinManagers as weixinManager>
							            			<option value="${weixinManager.id}">${weixinManager.name?if_exists}</option>
							            		</#list>
							            		-->
							            	</select>
					                	</div>
					                </div>
				                </div>
				                
				                <@shiro.hasPermission name='orderFixPrice'>
					                <div class="form-group">
					                    <label><em>&nbsp;&nbsp;</em>订单定价</label>
					                    <label>
							            	<input id="fixPrice" name="fixPrice" type="checkbox" />
							            </label>
					                </div>
					                
					                <div id="fixPrice_div" style="display:none;">
					                	<div class="form-group">
						                    <div class="col-sm-12">
						                    	<div class="input-group">
						                    	<span class="input-group-addon">定价金额</span>
								            	<input class="form-control" id="fixPriceMoney" name="fixPriceMoney" type="number" min="0" required/>
							                	<span class="input-group-addon">元</span>
							                	</div>
							                </div>
						                </div>
					                </div>
				                </@shiro.hasPermission>
				                
			                	<div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<span class="input-group-addon">预估金额</span>
							            	<input class="form-control" id="yuguMoney" name="yuguMoney" type="number" min="0" required/>
							            	<span class="input-group-addon">元</span>
					                	</div>
					                </div>
				                </div>
				                <div class="form-group">
							 	 	<div class="col-sm-3">
				            	 	</div>
							 		<div class="col-sm-9 detail">		               
					                  <span class="mileage2"></span>&nbsp&nbsp<span class="travelTime2"></span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <label><em>&nbsp;&nbsp;</em>订单备注：</label>
				                    <div class="col-sm-12">
						            	<textarea class="form-control" cols="20" id="memo" name="memo" rows="2"></textarea>
					                </div>
				                </div>
		    					
		    					<@shiro.hasPermission name='ordercreate'>
				                <div class="form-group">
					                <div class="col-sm-12">
					                	<input type="button" class="btn btn-primary btn-block" id="create-order" value="创建订单">
					                </div>
					            </div>
					            </@shiro.hasPermission>
					            
					            <div class="table-responsive">
					        		<table id="drivers-table" class="table table-condensed table-bordered">
										<tr style="font-size:14px;">
											<th>#</th>
											<th>服务人员姓名</th>
											<th>距离(公里)</th>
											<th>本日代驾</th>
											<th>本月代驾</th>
										</tr>
									</table>
								</div>
								
			        		</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		
		<div class="tab-pane in <#if default=="zhuan">active</#if>" id="zhuanTab">
      		<input type="hidden" id="passengerId3">
      		<input type="hidden" id="startLat3">
      		<input type="hidden" id="startLng3">
      		<input type="hidden" id="endLat3">
      		<input type="hidden" id="endLng3">
	  		<input type="hidden" id="startAddressDetail3">
	  		<input type="hidden" id="endAddressDetail3">
	  		<input type="hidden" id="carTypes">
	  		
			<div class="row">
				<div class="col-md-6">
					<div class="panel panel-default">
		  				<div id="allmap3" style="z-index: 99999; height:700px;">
						</div>
					</div>
				</div>
				<div class="col-md-6" >
					<form id="submit_form3" action="#" class="form-horizontal" method="post">
						<div class="panel-heading">
							<ul class="nav nav-tabs " id="serviceTypes" style="margin-left:10px;cursor:default;">
								<li serviceType="tangzu" class='active firstService'><a data-toggle='serviceTab' class='serviceType'>立即用车</a></li>
								<li serviceType="rizu"><a data-toggle='serviceTab' class='serviceType'>日租</a></li>
								<li serviceType="banrizu"><a data-toggle='serviceTab' class='serviceType'>半日租</a></li>
								<li serviceType="jieji"><a data-toggle='serviceTab' class='serviceType'>接机</a></li>
								<li serviceType="songji"><a data-toggle='serviceTab' class='serviceType'>送机</a></li>
								<li serviceType="jiezhan"><a data-toggle='serviceTab' class='serviceType'>接站</a></li>
								<li serviceType="songzhan"><a data-toggle='serviceTab' class='serviceType'>送站</a></li>
				            </ul>
					    </div>
				 		<div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户电话</span>
				            		<input class="form-control" id="passengerPhone3"  type="text" value=""  required/>
			                	</div>
			                </div>
			                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-info" style="font-size:14px;" id="membertype3"></span>
			                </div>
		                </div>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户姓名</span>
				            		<input class="form-control" id="passengerName3"  type="text" value=""  required/>
			                	</div>
			                </div>
			                <div class="col-sm-3" style="padding-left:0px;margin-top:5px;">
			                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual3">0元</span>
			                </div>
		                </div>
		                <@shiro.isMainCompany>
						<div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">所属公司</div>
					            	<select class="form-control" id="companyId3" />
					            		<#list companys as c>
					            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
					            		</#list>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                	</@shiro.isMainCompany>
	                	<div class="form-group">
        					<div class="col-sm-12">
			                    <div class="input-group">
			                    	<span class="input-group-addon start">预约地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="startAddress3"  type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-startAddress3">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
                		<div class="form-group">
        					<div class="col-sm-12">
			                    <div class="input-group">
			                    	<span class="input-group-addon start" >目的地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="endAddress3"  type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-endAddress3">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
		                
		               <div class="form-group endTime"> 
				            <div class='col-sm-12'>
				               <div class='input-group'>
			               			  <span  class="input-group-addon">预约时间</span>
				                      <input class='form-control' id="serverTime3"  type='text' value=""   required/>
				                      <span  class="add-on"><i class="icon-calendar"></i></span>
				               </div>
				            </div>
					   </div>
					   <div class="form-group" id="flightNo_div" style="display:none">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">航班编号</span>
				            		<input class="form-control" id="flightNo"  type="text" value=""  required/>
			                	</div>
			                </div>
		               </div>
		               <div class="form-group"  id="trainNo_div" style="display:none">
	                    	<div class="col-sm-12">
		                    	<div class="input-group">
			                    	<span class="input-group-addon">车次编号</span>
				            		<input class="form-control" id="trainNo"  type="text" value=""  required/>
			                	</div>
			                </div>
		                </div>
					    <div class='form-group col-sm-12' style="margin-top:10px;display:none;">
					     		<span id="priceText" style="width:100%; position:absolute; bottom:0; text-align:center;"></span>
					    </div>
					    <div id="carTypes_div">
					    <#if carTypes??>
					    	<#list carTypes as carType>
						 	<div class="form-group">
			                    <div class="col-sm-6">
			                    	<div class="input-group carType_div" carTypeId="${carType.id?if_exists}">
				                    	<span  class="input-group-addon">${carType.typeName?if_exists}</span>
					                    <input class='form-control carNumber'  type='number' min='0'></input>
					                    <span class="input-group-addon">辆</span>
				                	</div>
			                	</div>
			                	<div class="col-sm-6">
			                		<div class="input-group">
			                			<span  class="input-group-addon">车型预计</span>
		                			 	<input class='form-control yuguMoney' type='text'/>
		                			 	<span class="input-group-addon">元</span>
				                	</div>
				                </div>
		                	</div>
		                	</#list>
	                	</#if>
					    </div>
                        <div class="form-group">
                            <label><em>&nbsp;&nbsp;</em>订单定价</label>
                            <label>
                                <input id="isMakePrice" name="isMakePrice" value="0" type="checkbox" />
                            </label>
                        </div>
                        <div id="makePrice_div" style="display:none;">
                            <div class="form-group">
                                <div class="col-sm-12">
                                    <div class="input-group">
                                        <span class="input-group-addon">定价金额</span>
                                        <input class="form-control" id="makePrice" name="makePrice" type="number" min="0" required/>
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                            </div>
                        </div>

					 	<div class="form-group">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 		<div class="col-sm-9 detail">		               
			                  <span id="sumCar_sumMoney"></span>
			                </div>
		                </div>
		                <div style="margin-top:-30px;">
			                <label class="control-label">用车需求:</label>
			                <div class="form-group">
								<div class="col-sm-12">
									 <textarea class="form-control" cols="30" id='zhuan_memo' name="zhuan_memo" rows="2"></textarea>
								</div>
							 </div>
						 </div>
		                <@shiro.hasPermission name='zhuanCreate'>
	                	<div class="form-group">
			                <div class="col-sm-12">
			                	<input type="button" class="btn btn-primary btn-block" id="zhuanCreate"  value="预约专车"/>
			                </div>
			            </div>
			            </@shiro.hasPermission>
			            <!--			           
			            <div class="form-group">
		            		<div class="col-md-12 col-md-offset-9">
		                   		<label class="dowebok">
					            	<input id="limit"  type="checkbox" data-labelauty="限行车辆" >
					            </label>
			                    <label style="font-size:15px;"></label>
		                	</div>
		                	<div class="col-sm-3">
		            	 	</div>
					    	<div class="col-sm-12  table-responsive">
				        		<table id="drivers-table" class="table table-condensed table-bordered">
									<tr style="font-size:15px;">
										<th>#</th>
										<th>员工姓名</th>
										<th>驾驶车辆</th>
										<th>距离(公里)</th>
									</tr>
									<tbody id="tbodyId">
									
									</tbody>
								</table>
							</div>
						</div>
						-->
						
					</form>
				</div>
			</div>
		</div>
		<div class="tab-pane in <#if default=="freight">active</#if>" id="freightTab">
      		<input type="hidden" id="freight_passengerId"/>
      		<input type="hidden" id="freight_startLat"/>
      		<input type="hidden" id="freight_startLng" />
      		<input type="hidden" id="freight_endLat" />
      		<input type="hidden" id="freight_endLng" />
      		<input type="hidden" id="freight_startPrice" />
	  		<input type="hidden" id="freight_mileagePrice" />
	  		<input type="hidden" id="freight_runTimePrice"/>
	  		<input type="hidden" id="freight_runTime" />
	  		<input type="hidden" id="freight_mileage" />
	  		<input type="hidden" id="freight_employId"/>
	  		<div class="row">
	  			<div class="col-sm-6">
					<div class="panel panel-default">
		  				<div id="freight_allmap" style="z-index:8888; height:700px;">
						</div>
					</div>
				</div>
				<div class="col-sm-6">
					<form id="submit_form_freight" action="#" class="form-horizontal" method="post">
						<div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户电话</span>
				            		<input class="form-control" id="freight_passengerPhone"  type="text" value=""  required/>
			                	</div>
			                </div>
			                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-info" style="font-size:14px;" id="freight_membertype"></span>
			                </div>
		                </div>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户姓名</span>
				            		<input class="form-control" id="freight_passengerName"  type="text" value=""  required/>
			                	</div>
			                </div>
			                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-warning" style="font-size:14px;" id="freight_clientVirtual">0元</span>
			                </div>
		                </div>
		               <@shiro.isMainCompany>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">所属公司</div>
					            	<select class="form-control" id="freight_companyId" />
					            		<#list companys as c>
					            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
					            		</#list>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                   </@shiro.isMainCompany>
	                	<div>
	                	   <span>第一个途径地为起始地<font color="red">(不能删除)</font>最后一个为目的地<font color="red">(不能删除)</font></span><br/>
	                	   <span>点击地址输入框 填写联系人和联系电话</span>
	                	</div>
	                	<div class="form-group wayAddress" id="start">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">起始地址</span>
				            		<input class="form-control waypointAddress" id="freight_startAddress" onfocus="showData(this)" index="0" waypointLng="" waypointLat="" type="text" value=""  required/>
			                	</div>
			                	<div class="show"><font style="font-size:10px"> 联系人:<span class="showContacts"></span></font> <font style="font-size:10px">联系电话:<span class="showPhone"></span></font></div>
			                	<div class="col-sm-12" style="display:none;">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">联系人员</span>
					            	  <input class="form-control waypointContacts" />
				                	</div>
				                </div>
				                 <div class="col-sm-12" style="display:none;">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">联系电话</span>
					            	   <input class="form-control waypointPhone" required/>
				                	</div>
				                </div>
			                </div>
		                </div>
                        <div id="waypointItem">
                          
			            </div>
			            <div class="form-group wayAddress" id="end">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">目的地址</span>
				            		<input class="form-control waypointAddress" id="freight_destination" onfocus="showData(this)" index="1" waypointLng="" waypointLat="" type="text" value=""  required/>
			                	</div>
			                	<div class="show"><font style="font-size:10px"> 联系人:<span class="showContacts"></span></font> <font style="font-size:10px">联系电话:<span class="showPhone"></span></font></div>
			                	<div class="col-sm-12" style="display:none">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">联系人员</span>
					            	    <input class="form-control waypointContacts" id="contacts"/>
				                	</div>
				                </div>
				                <div class="col-sm-12" style="display:none">
			                        <div class="input-group col-sm-12">
			                    	   <span class="input-group-addon">联系电话</span>
					            	    <input class="form-control waypointPhone" id="phone" required/>
				                	</div>
				                </div>
			                </div>
			                <div class="col-sm-2" style="margin-left:-13px;">
		                       <label><span class="glyphicon glyphicon-plus waypointIcon addAddress" style="cursor:pointer;" title="添加途径地"></span></label>
		                     </div>
		                </div>
                        <div class="form-group">
			                <div class="col-sm-9">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon">预约时间</span>
				            	    <input class="form-control inputTime" id="freight_startTime" required/>
			                	</div>
			                </div>
	                	</div>
						 <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">货车类型</div>
					            	<select class="form-control" id="truckTypeId" />
					            		<#if truckTypes??>
											<#list truckTypes as truckType>
												<option value="${truckType.id}">${truckType.typeName?if_exists}<#if truckType.cangointotown>--入城</#if></option>
											</#list>
										</#if>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                	<div class="form-group" id="couponInput" style="display:none">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">可用优惠券</div>
					            	<select class="form-control" id="freight_couponId" />
					            		
					            	</select>
			                	</div>
			                </div>
	                	</div>
		                <div class="form-group">
			                <div class="col-sm-9">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon">预计金额</span>
				            	    <div class="input-group">
							          <input class="form-control" id="freight_budgetPay" maxlength="10000" type="number" min="0" />
						      		  <span class="input-group-addon">元</span>
						      		</div>
			                	</div>
			                </div>
	                	</div>
						<@shiro.hasPermission name='freightOrderFixPrice'>
							<div class="form-group">
								<label><em>&nbsp;&nbsp;</em>订单定价</label>
								<label>
									<input id="freightfixPrice" name="fixPrice"  type="checkbox">
								</label>
							</div>
							<div id="freightfixPrice_div" style="display: none;">
								<div class="form-group">
									<div class="col-sm-9">
										<div class="input-group">
											<span class="input-group-addon">定价金额</span>
											<input class="form-control" id="freightfixPriceMoney" name="fixPriceMoney" type="number" min="0" required="">
											<span class="input-group-addon">元</span>
										</div>
									</div>
								</div>
							</div>
						</@shiro.hasPermission>
	                	<div class="form-group">
		                  <div class="input-group" >
							 	<ul class="dowebok">
									<li><input type="checkbox" name="flitting"  data-labelauty="搬运"></li>
									<li><input type="checkbox" name="receipt"  data-labelauty="回单"></li>
									<li><input type="checkbox" name="receivedPay"   data-labelauty="回款"></li>
									<li style="position:relative;top:-5px;left:0px;display:none;" class="receivedPay">
									     <input class="form-control" placeholder="金额" type="number" min="0" id="payMount"  max="100000" name="payMount"  style="width:80px;"/>
								 	     <span class="input-group-addon" style="height:34px;margin-top:50px;">元</span>
									</li>
								</ul>
							</div>
		                </div>
		                <div class="form-group" style="margin-top:-35px;">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 		<div class="col-sm-9 detail">				               
			                  <span class="freight_mileage"></span>&nbsp&nbsp<span class="freight_runTime"></span>
			                </div>
		                </div>
		                <div style="margin-top:-35px;">
		                <label class="control-label">订单备注:</label>
		                <div class="form-group">
							<div class="col-sm-9">
								 <textarea class="form-control" cols="20" id='freight_orderMemo' name="memo" rows="4"></textarea>
							</div>
						 </div>
						 </div> 
						 <div class="form-group">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 	 	<div class="col-sm-9">
					 	 	  <@shiro.hasPermission name='freightCreate'>
		                 	  <input  type="button" class="btn btn-primary" id="freight_saveOrder" value="预约"/>
		                 	  </@shiro.hasPermission>
						      <button type="button"  class="btn btn-default" id="freight_close_modal">取消</button>
					        </div>
				        </div>
				        <div class="form-group">
					        <div class="col-sm-9  table-responsive">
					        		<table id="freight_drivers-table" class="table table-condensed table-bordered">
										<tr style="font-size:15px;">
											<th>#</th>
											<th>员工姓名</th>
											<th>驾驶车辆</th>
											<th>距离(公里)</th>
										</tr>
										<tbody id="freight_tbodyId">
										
										</tbody>
									</table>
							</div>
						</div>
					</form>
				</div>
	  		</div>
		</div>
		<div class="tab-pane in <#if default=="zhuanxian">active</#if>" id="zhuanxianTab">
      		<input type="hidden" id="zhuanxian_passengerId"/>
      		<input type="hidden" id="zhuanxian_startLat"/>
      		<input type="hidden" id="zhuanxian_startLng" />
      		<input type="hidden" id="zhuanxian_endLat" />
      		<input type="hidden" id="zhuanxian_endLng" />
      		<input type="hidden" id="zhuanxian_startPrice" />
	  		<input type="hidden" id="zhuanxian_mileagePrice" />
	  		<input type="hidden" id="zhuanxian_runTimePrice"/>
	  		<input type="hidden" id="zhuanxian_runTime" />
	  		<input type="hidden" id="zhuanxian_mileage" />
	  		<input type="hidden" id="zhuanxian_employId"/>
	  		<div class="row">
	  			<div class="col-sm-6">
					<div class="panel panel-default">
		  				<div id="zhuanxian_allmap" style="z-index:8888; height:700px;">
						</div>
					</div>
				</div>
				
				<div class="col-sm-6">
					<div class="panel panel-default">
							<div class="panel-heading">
								<ul class="nav nav-tabs navigation" id="zhuanxian_orderType" style="margin-left:30px;cursor:default;">
								 <li class="active"  val="0"><a id="" href="#" data-toggle="tab">拼车</a></li>
								 <li val="1"><a  href="#" data-toggle="tab">包车</a></li>
								 <li val="2"><a  href="#" data-toggle="tab">寄货</a></li>
								</ul>
						    </div>
					   <div class="panel-body">
					
					<form id="submit_form_zhuanxian" action="#" class="form-horizontal" method="post">
						<div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户电话</span>
				            		<input class="form-control" id="zhuanxian_passengerPhone"  type="text" value=""  required/>
			                	</div>
			                </div>
			                 <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-info" style="font-size:14px;" id="zhuanxian_membertype"></span>
			                </div>
		                </div>
		                <div class="form-group">
		                    <div class="col-sm-9">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">客户姓名</span>
				            		<input class="form-control" id="zhuanxian_passengerName"  type="text" value=""  required/>
			                	</div>
			                </div>
			                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
			                	<span class="label label-warning" style="font-size:14px;" id="zhuanxian_clientVirtual">0元</span>
			                </div>
		                </div>
		               <@shiro.isMainCompany>
		                <div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">所属公司</div>
					            	<select class="form-control" id="zhuanxian_companyId" />
					            		<#list companys as c>
					            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
					            		</#list>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                   </@shiro.isMainCompany>
                        <div class="form-group">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon" id="zhuanxian_startTime_text">预约时间</span>
				            	    <input class="form-control inputTime" id="zhuanxian_startTime" required/>
			                	</div>
			                </div>
	                	</div>
						 <div class="form-group">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">线&emsp;&emsp;路</div>
					            	<select class="form-control" id="lineId" />
					            		<#if lines??>
											<#list lines as line>
												<option value="${line.id}"  startcity="${line.startCity}" jihuoareaid="${line.jihuoAreaId?if_exists}" baocheareaid="${line.baocheAreaId?if_exists}" pingcheareaid="${line.areaId?if_exists}" startaddress="${line.startAddress?if_exists}" endcity="${line.endCity}" endaddress="${line.endaddress?if_exists}" >${line.name?if_exists}</option>
											</#list>
										</#if>
					            	</select>
			                	</div>
			                </div>
	                	</div>
	                	<div class="form-group" id="zhuanxian_peopleNumber_div">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon" id="zhuanxian_peopleNumber_text">乘车人数</span>
							          <input class="form-control" id="zhuanxian_peopleNumber" maxlength="10000" type="number" min="1" value="1" />
						      		  <span class="input-group-addon" id="zhuanxian_peopleNumber_text_addon">位</span>
						      		
			                	</div>
			                </div>
	                	</div>
	                	<div class="form-group">
        					<div class="col-sm-11">
			                    <div class="input-group">
			                    	<span class="input-group-addon start">预约地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="zhuanxianStartAddress"  type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-zhuanxianStartAddress">定位</button>
				                    </span>
			                    </div>
			                </div>
		                </div>
						<div class="form-group">
							<div class="col-sm-11">
								<div id="zhuanxian_wanghuan">
									<a href="javascript:void(0);"><img src="${ctx}/assets/img/returnBack.png"></a>
								</div>
							</div>
						</div>
	                	<div class="form-group">
        					<div class="col-sm-11">
			                    <div class="input-group">
			                    	<span class="input-group-addon end" >目的地址</span>
				                    <input placeholder="附近的小区/街道/商圈" class="form-control" id="zhuanxianEndAddress"  type="text"  autocomplete="off" required/>
				                    <span class="input-group-btn">
			                            <button class="btn btn-default" type="button" id="btn-zhuanxianEndAddress">定位</button>
				                    </span>
			                    </div>
			                </div>
<#--			                <div class="col-sm-1" style="margin-left:-20px;margin-top:-30px;" id="zhuanxian_wanghuan">-->
<#--			                  <a href="javascript:void(0);"><img src="${ctx}/assets/img/往返.png"></a>-->
<#--			                </div>-->
		                </div>
	                	<div class="form-group" id="zhuanxianTakeDelivery_div" style="display:none;">
		                    <div class="col-sm-6">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">收货人姓名</span>
				            		<input class="form-control" id="zhuanxian_takeDeliveryName"  type="text" value=""  required/>
			                	</div>
			                </div>
		                    <div class="col-sm-6">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">收货人电话</span>
				            		<input class="form-control" id="zhuanxian_takeDeliveryPhone"  type="text" value=""  required/>
			                	</div>
			                </div>
		                </div>
	                	<div class="form-group" id="zhuanxiancouponInput" style="display:none">
		                    <div class="col-sm-12">
		                    	<div class="input-group">
			                    	<div class="input-group-addon">可用优惠券</div>
					            	<select class="form-control" id="zhuanxian_couponId" >
					            		
					            	</select>
			                	</div>
			                </div>
	                	</div>
		                <div class="form-group">
			                <div class="col-sm-12">
		                        <div class="input-group col-sm-12">
		                    	   <span class="input-group-addon">预计金额</span>
				            	    <div class="input-group">
							          <input class="form-control" id="zhuanxian_budgetPay" maxlength="10000" type="number" min="0" />
						      		  <span class="input-group-addon">元</span>
						      		</div>
			                	</div>
			                </div>
	                	</div>
		                <div class="form-group" style="margin-top:-35px;">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 		<div class="col-sm-9 detail">				               
			                  <span class="zhuanxian_mileage"></span>&nbsp&nbsp<span class="zhuanxian_runTime"></span>
			                </div>
		                </div>
		                <div style="margin-top:-10px;">
		                <label class="control-label">订单备注:</label>
		                <div class="form-group">
							<div class="col-sm-12">
								 <textarea class="form-control" cols="20" id='zhuanxian_orderMemo' name="memo" rows="4"></textarea>
							</div>
						 </div>
						 </div> 
						 <div class="form-group">
					 	 	<div class="col-sm-3">
		            	 	</div>
					 	 	<div class="col-sm-12">
					 	 	  <@shiro.hasPermission name='zhuanxianCreate'>
		                 	  <input  type="button" class="btn btn-primary btn-block" id="zhuanxian_saveOrder" value="预约"/>
		                 	  </@shiro.hasPermission>
					        </div>
				        </div>
				       <div class="form-group">
					        <div class="col-sm-12  table-responsive">
					        		<table id="zhuanxian_drivers-table" class="table table-condensed table-bordered">
										<tr style="font-size:15px;">
											<th>#</th>
											<th>员工姓名</th>
											<th>驾驶车辆</th>
											<th>距离(公里)</th>
										</tr>
										<tbody id="zhuanxian_tbodyId">
										
										</tbody>
									</table>
							</div>
						</div>
					</form>
					</div>
					</div>
				</div>
	  		</div>
	  		
		</div>
		<div class="tab-pane in <#if default=="errand">active</#if>" id="errandTab">
			<div class="row">
				<form id="submit_form2" action="#" class="form-horizontal" method="post">
			  		<input type="hidden" id="startLat"/>
			  		<input type="hidden" id="startLng"/>
			  		<input type="hidden" id="deliverLat"/>
			  		<input type="hidden" id="deliverLng"/>
			  		<input type="hidden" id="passengerId"/>
			  		<input type="hidden" id="companyName"/>
			  		<input type="hidden" id="startPrice"/>
			  		<input type="hidden" id="mileagePrice"/>
			  		<input type="hidden" id="travelTimePrice"/>
			  		<input type="hidden" id="travelTime"/>
			  		<input type="hidden" id="mileage"/>
			  		<input type="hidden" id="startDetailedAddress">
	  				<input type="hidden" id="deliverDetailedAddress">
					<div class="col-md-6">
						<div class="panel panel-default">
			  				<div id="allmap2" style="z-index: 99999; height:700px;">
							</div>
						</div>
					</div>
					<div class="col-md-6" >
						<div class="panel panel-default">
							<div class="panel-heading">
								<ul class="nav nav-tabs navigation" id="title" style="margin-left:30px;cursor:default;">
					            </ul>
						    </div>
					    	<div class="panel-body">
				                <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户手机</span>
						            		<input class="form-control" id="passengerPhone"  type="text" value=""  required/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-info" style="font-size:14px;" id="membertype2"></span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-9">
				                    	<div class="input-group">
				                    		<span class="input-group-addon">客户姓名</span>
						            		<input class="form-control" id="passengerName"  type="text" value=""  required/>
					                	</div>
					                </div>
					                <div class="col-sm-3" style="padding-left:0px;margin-top:6px;">
					                	<span class="label label-warning" style="font-size:14px;" id="clientVirtual2">0元</span>
					                </div>
				                </div>
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<div class="input-group-addon">所属公司</div>
							            	<select class="form-control" id="companyId2" />
							            		<#list companys as c>
							            			<option data-city="${c.cityName}" value="${c.id}" <#if c.id==companyId>selected="selected"</#if>>${c.abbreviation?if_exists}</option>
							            		</#list>
							            	</select>
					                	</div>
					                </div>
				                </div>
				                <div class="form-group">
				                	<div class="col-sm-12" id="imgs" >
				                		<input type="hidden" name="imgs" id="imgsUrl"/>
										<div class="row">
											<div class="col-sm-6">
											<span class="help-block">建议图片大小400x400</span>
											</div>
											<div class="col-sm-3" >
											<button  type="button"  class="button button-pill button-flat-primary button-tiny" id="shareImage_btn">
												<i class="glyphicon glyphicon-open" ></i>添加图片</button>
											</div>
											<div class="col-sm-3">
											<button  type="button"  id="deleteImg" class="pull-right button button-pill button-flat-caution button-tiny">
								        		<i class="glyphicon glyphicon-remove" ></i>删除图片</button>
								        	</div>
										</div>
										<input style="display:none;" type="file" name="imgFile" id="shareImage_file" accept=".bmp,.gif,.jpeg,.jpg,.png" />
									</div>
								</div>
						         <div class="tab-content ">
						            <div id="tab" class="tab-pane active">
						            	<div class="form-group">
						                   <div class="col-sm-12">
							                    <div class="input-group">
							                    	<span class="input-group-addon startAddress">请输入地址</span>
								                    <input placeholder="附近的小区/街道/商圈" class="form-control autoComplete" id="startAddress" lng="" lat="" type="text" index="0" value="" autocomplete="off" required/>
								                    <span class="input-group-btn">
							                            <button class="btn btn-default btn-deliverAddress" type="button" >定位</button>
								                    </span>
							                    </div>
							                </div>
						                </div>
						                <div class="form-group ">
						                   <div class="col-sm-12">
							                    <div class="input-group">
							                    	<span class="input-group-addon deliverAddress">请输入地址</span>
								                    <input placeholder="附近的小区/街道/商圈" class="form-control autoComplete" id="deliverAddress" lng="" lat="" index="1" type="text" value="" autocomplete="off" required/>
								                    <span class="input-group-btn">
							                            <button class="btn btn-default btn-deliverAddress" type="button">定位</button>
								                    </span>
							                    </div>
							                </div>
						                </div>
						            </div>
						        </div>
				             	<div class="form-group">
				                    <div class="col-sm-6">
				                    	<div class="input-group">
							             <span class="input-group-addon" id="valuationType"></span>
								         <input class="form-control" id="shouldPay" name="shouldPay" type="number" min="0" required/>
							      		 <span class="input-group-addon">元</span>
							      		 </div>
					                </div>
					                <div class='col-sm-6'>
							        		<div class='input-group'>
						                 	<span class='input-group-addon'>预约时间</span>
						                 	<input class='form-control' id='startTime'  type='text' value=""  required/>
						                 	</div>
					                </div>
				                </div>
				                
				                <div class="form-group" id="errand_couponInput" style="display:none">
				                    <div class="col-sm-12">
				                    	<div class="input-group">
					                    	<div class="input-group-addon">可用优惠券</div>
							            	<select class="form-control" id="errand_couponId" />
							            		
							            	</select>
					                	</div>
					                </div>
			                	</div>
			                	<div class="form-group">
							 	 	<div class="col-sm-3">
				            	 	</div>
							 		<div class="col-sm-9 detail">		               
					                  <span class="mileage_text"></span>&nbsp;&nbsp;<span class="travelTime_text"></span>
					                </div>
				                </div>
				                <div class="form-group">
				                	 <div class="col-sm-12">
					                    <label class="control-label">任务内容</label>
									</div>
								</div>
								
				                <div class="form-group">
				                    <div class="col-sm-12">
				                    	<textarea class="form-control" cols="60"  id="content" rows="4"></textarea>
					                </div>
				                </div>
				                <@shiro.hasPermission name='errandCreate'>
				                <div class="form-group">
					                <div class="col-sm-12">
					                	<input type="button" class="btn btn-primary btn-block" id="errandCreate" value="呼叫跑腿"/>
					                </div>
					            </div>
					            </@shiro.hasPermission>
						    </div>
						    
					    </div>
				    </div>
				</form>
			</div>
		</div>
		
	</div>
</div>
</div>
<#--货运-->
<div class="modal fade" id="myModal" style="margin-left:588px;margin-top:187px;width:360px;z-index:3" >
  <div class="modal-dialog">
    <div class="modal-content" style="width:360px;">
   <#--  <span class="glyphicon glyphicon-remove colse" style="margin-left:310px; cursor:pointer;"></span>-->
      <div class="modal-body" >
         <div style="width:300px;">
	        <div class="input-group " style="">
				<span class="input-group-addon">详细地址</span>
				<input class="form-control" placeholder="附近标志性建筑物/街道/商圈" waypointLng="" waypointLat=""  id="Address"/>
			</div>
			<br/>
			<div >
				<div class="input-group col-sm-12">
				   <span class="input-group-addon">联系人员</span>
				  <input class="form-control " id="tempContacts"/>
				</div>
			</div>
			<br/>
			<div >
				<div class="input-group col-sm-12">
				   <span class="input-group-addon">联系电话</span>
				   <input class="form-control " id="tempPhone" required/>
				</div>
			</div>
			<center style="margin-top:10px;">
				<button type="button" class="btn btn-default colse">确定</button>
				<button type="button" class="btn btn-default colse">取消</button>
			</center>
        </div>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal-->
<script type="text/javascript" language="javascript">
	window.daijia = {ctx : '${ctx}',address : '${address?if_exists}',iserrand:'${default?if_exists}',lng:'${lng?if_exists}',lat:'${lat?if_exists}',mainCompany:'${mainCompany?if_exists}'};
	var isMain = false;
	<@shiro.isMainCompany>
    	isMain = true;
	</@shiro.isMainCompany>
</script>
<script src="${ctx}/assets/js/jquery-1.9.1.min.js"></script>
<script src="${ctx}/assets/js/bootstrap.min.js"></script>
<script src="${ctx}/assets/js/sco.modal.js"></script>
<script src="${ctx}/assets/js/sco.message.js"></script>
<script src="${ctx}/assets/js/sco.confirm.js"></script>
<script src="//api.map.baidu.com/api?v=2.0&ak=AuNk3YS21DSmHEEvIFDf9dbD"></script> 
<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/freight/jquery-labelauty.js"></script>
<script src="${ctx}/assets/js/jquery.autocomplete.js"></script>
<script src="${ctx}/assets/js/chosen.jquery.min.js"></script>
<@freight>
<script src="${ctx}/assets/js/freight/create.js"></script>
</@freight>
<@zhuan>
<script src="${ctx}/assets/js/zhuanche/create.js"></script>
</@zhuan>
<@zhuanxian>
<script src="${ctx}/assets/js/zhuanxian/create.js"></script>
</@zhuanxian>
<script src="${ctx}/assets/js/errand/create.js"></script>
<script src="${ctx}/assets/js/chosen.jquery.min.js"></script>
<script type="text/javascript">
	$('.dowebok input[type=checkbox]').labelauty();
	<@freight>
	$("#freight_startTime").datetimepicker({format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true,startDate:new Date()});
	$("#freight_startTime").val(new Date(new Date().getTime()+1000*60*3).Format("yyyy-MM-dd hh:mm"));
	</@freight>
	var date = new Date().Format("yyyy-MM-dd hh:mm");
	$("#startTime").val(date);
	<#if message??>
		$.scojs_message("${message}", $.scojs_message.TYPE_ERROR);
	</#if>
	var map = null; //地图对象
	var driving2=null;//规划路线的对象
	var start_Point = new Array();
	var end_Point = new Array();
	var temp_point=null;
	function initialize(){
		var myGeo = new BMap.Geocoder();
		myGeo.getPoint("${address?if_exists}", function(point){
			if (point) {
			temp_point=point;
				map = new BMap.Map("allmap"); 
				map.centerAndZoom(point, 13);
			    map.enableScrollWheelZoom();
			    
			    driving2 = new BMap.DrivingRoute(map, {
			    	policy : BMAP_DRIVING_POLICY_LEAST_DISTANCE,    
					onSearchComplete: function(results){   
						if (driving2.getStatus() == BMAP_STATUS_SUCCESS){ 
						 // 获取第一条方案   
						 var plan = results.getPlan(0); 
						 var distance=plan.getDistance();
						 var timeStr=plan.getDuration();
						  
						 $.post("${ctx}/order/getPrice",
							   {passengerId:$('#passengerId').val(),
							    companyId:$("#companyId").val(),
							    time:timeStr,
							    mileage:distance},function(data){
								    if(data.success){
								    	$("#yuguMoney").val(data.money);
								    	$(".travelTime2").text("预计时间:"+data.travelTime+"分钟");
								    	$(".mileage2").text("预计路程:"+data.mileage+"公里");
								    }else{
									    $("#yuguMoney").val(data.money);
								    	$(".travelTime2").text("预估价格失败");
								    }							    	
							    },"json");
						}
					},
					renderOptions: {    //显示到地图上
						map: map,    
						autoViewport: true 
					}  
				});
				
			    //右键菜单
			    var contextMenu = new BMap.ContextMenu();
				var txtMenuItem = [{
				   text:'设为预约地',
				   callback:function(p){
				   		map.clearOverlays();
				   		
				   		var memberMarker = new BMap.Marker(p);  // 创建标注
		    			map.addOverlay(memberMarker);
		    			
		    			markerComplete(p.lng,p.lat);
		    			var gc = new BMap.Geocoder();
					    gc.getLocation(p, function(rs){
					        var addComp = rs.addressComponents;
					        $("#fromPlace").val(addComp.street);
					        $("#fromPlaceDetail").val("");
							if(rs.surroundingPois[0].title.trim()!=null && rs.surroundingPois[0].title.trim()!=""){
								$("#fromPlaceDetail").val(rs.surroundingPois[0].title);
							}
					    });
			    
	    			  	start_Point[0]=p.lng;
				        start_Point[1]=p.lat;
				        if(end_Point.length!=0){
				        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
							var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
							map.centerAndZoom(startPoint, 10); 
							driving2.search(startPoint, endPoint);
				        }
				   }
				},{
				   text:'设为目的地',
				   callback:function(p){
				   		map.clearOverlays();
				   		
				   		var memberMarker = new BMap.Marker(p);  // 创建标注
		    			map.addOverlay(memberMarker);
		    			
		    			$("#toPlaceLongitude").val(p.lng);
						$("#toPlaceLatitude").val(p.lat);
		    			
		    			var gc = new BMap.Geocoder();
					    gc.getLocation(p, function(rs){
					        var addComp = rs.addressComponents;
					        $("#toPlace").val(addComp.street);
					    	$("#toPlaceDetail").val("");
					        if(rs.surroundingPois[0].title.trim()!=null && rs.surroundingPois[0].title.trim()!=""){
				        	   $("#toPlaceDetail").val(rs.surroundingPois[0].title);
					        }
					    });   
					    end_Point[0]=p.lng;
				        end_Point[1]=p.lat;
				        if(start_Point.length!=0){
				        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
							var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
							map.centerAndZoom(startPoint, 10); 
							driving2.search(startPoint, endPoint);
				        }      
				   }
				}];
				for(var i=0; i < txtMenuItem.length; i++){
					contextMenu.addItem(new BMap.MenuItem(txtMenuItem[i].text,txtMenuItem[i].callback,100));
					if(i==1 || i==3) {
						contextMenu.addSeparator();
					}
				}
				map.addContextMenu(contextMenu); 
			}
			else{
				$.scojs_message("地区"+'${address?if_exists}'+"位置不准确，请重新编辑地区", $.scojs_message.TYPE_ERROR);
			}
		});
	}
	
	function formCheck(){
		if($("#serverDate").val()=='' || $("#serverTime").val()==''){
			$.scojs_message("服务时间不能为空", $.scojs_message.TYPE_ERROR);
			return false;
		}
		if($("#driverNum").val()==''){
			$.scojs_message("人数不能为空", $.scojs_message.TYPE_ERROR);
			return false;
		}
		if($("#clientPhone").val()==''){
			$.scojs_message("客户手机不能为空", $.scojs_message.TYPE_ERROR);
			return false;
		}
		return true;
	}
	
	$(document).ready(function(){
	   $('input[maxlength]').focusout(function(){
	   var valstr = $(this).val();
	   var length = $(this).attr("maxlength");
	   var val = parseFloat(valstr)
	   if(val>length){
	       $.scojs_message("输入的金额过大");
	       $(this).val("");
	   }
	   if(valstr.split(".").length>1){
	      if(valstr.split(".")[1].length>2){
	         $.scojs_message("输入金额的小数位数过多");
	         $(this).val("");
	      }
	   }
	});
	

		
	<#if default=="daijia">
		initialize();
	</#if>
	
	$("#daijiaClick").click(function(){
		initialize();
	});
	
	$("#deliverTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
	$("#startTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true,startDate:'${(.now)?string('yyyy-MM-dd HH:mm')}'  });
		
	$("#startTime3").datetimepicker({format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
	$("#serverTime3").datetimepicker({format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'hour', pickDate: true, pickTime: false, inputMask: false, autoclose: true,startDate:'${(.now)?string('yyyy-MM-dd HH:mm')}' });
	
	$('#serverTime3').change(function(){
 		if(!(/^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)\s+([01][0-9]|2[0-3]):[0-5][0-9]$/.test($('#serverTime3').val()))){
           $.scojs_message("请输入正确的时间格式,如:2015-12-30 12:30", $.scojs_message.TYPE_ERROR);
           $('#serverTime3').val('');
      	}
	});

	$("#serverDate").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true,startDate:'${(.now)?string('yyyy-MM-dd')}'  });
	
	$("#serverTime").datetimepicker({ format: 'HH:ii', language: 'zh-CN',minView: 'hour', startView: 'day', pickDate: true, pickTime: true, inputMask: false, autoclose: true,startDate:'${(.now)?string('yyyy-MM-dd')}' });
	
	$("#paidanTime").datetimepicker({ format: 'yyyy-mm-dd HH:ii', language: 'zh-CN', pickDate: true, pickTime: true, inputMask: false, autoclose: true });
	
	//定位
	$("#btn-position").click(function(){
		if($("#fromPlace").val()==''){
			$.scojs_message("请填写代驾地点", $.scojs_message.TYPE_ERROR);
		}
		else{
			map.clearOverlays();
			var local = new BMap.LocalSearch(map, {
	    	  renderOptions:{map: map, autoViewport:true}
	    	});
		    local.search($("#fromPlace").val());
		    
		    local.setInfoHtmlSetCallback(function(poi,html){
				markerComplete(poi.marker.point.lng,poi.marker.point.lat);
				start_Point[0]=poi.marker.point.lng;
				start_Point[1]=poi.marker.point.lat;
				var title = poi.marker.getTitle();
				var markers = map.getOverlays();
				for(var i=0;i<markers.length;i++){
					markers[i].show();
				}
				if(end_Point.length!=0){
					var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
					var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
					driving2.search(startPoint, endPoint);
					poi.marker.hide(); 
				}
			});
			
		}
	});
	//定位
	$("#btn_toPlace").click(function(){
		if($("#toPlace").val()==''){
			$.scojs_message("请填写代驾目的地", $.scojs_message.TYPE_ERROR);
		}else{
			map.clearOverlays();
			var local = new BMap.LocalSearch(map, {
	    	  renderOptions:{map: map, autoViewport:true}
	    	});
		    local.search($("#toPlace").val());
		    
		    local.setInfoHtmlSetCallback(function(poi,html){
			
				$("#toPlaceLongitude").val(poi.marker.point.lng);
				$("#toPlaceLatitude").val(poi.marker.point.lat);
				end_Point[0]=poi.marker.point.lng;
				end_Point[1]=poi.marker.point.lat;
				var title = poi.marker.getTitle();
				var markers = map.getOverlays();
				for(var i=0;i<markers.length;i++){
					markers[i].show();
				}
				if(start_Point.length!=0){
					var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
					var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
					driving2.search(startPoint, endPoint);
					poi.marker.hide(); 
				}
			});
		
		}
	});
	
	//创建订单
	$("#create-order").click(function(){
		if($("#fromPlace").val()=='' || $("#longitude").val()=='' || $("#latitude").val()==''){
			$.scojs_message("请先定位代驾地点", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		var clientPhone=$("#clientPhone").val();
		var isphone=/^\+?\d{3,13}(\-?(\d{6,8}?))?(\-?(\d{4,8}?))*$/; 
		if (!isphone.test(clientPhone)){
			$.scojs_message("客户手机格式不正确", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		if($("#fixPrice").length>0 && $("#fixPrice")[0].checked){
			if($("#fixPriceMoney").val()==""){
				$.scojs_message("请填写定价金额", $.scojs_message.TYPE_ERROR);
				return false;
			}
			var moneyReg=/^(\d+)(.[0-9]{0,1})?$/;
			if(!moneyReg.test($("#fixPriceMoney").val())){
				$.scojs_message("请填写正确的定价金额，如：39.9", $.scojs_message.TYPE_ERROR);
				return false;
			}
		}
		
		var fc=formCheck();
		if(!fc){
			return false;
		}
		
		if($("input[name=check_drivers]:checked").length > 0){
			if($("input[name=check_drivers]:checked").length!=$("#driverNum").val()){
				$.scojs_message("需要选择"+$("#driverNum").val()+"名服务人员", $.scojs_message.TYPE_ERROR);
				return false;
			}
		}
		
		if($("#couponIds option:selected").length>$("#driverNum").val()){
			$.scojs_message("最多选择"+$("#driverNum").val()+"张优惠券", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		if($("#fixPriceMoney").length>0){
			if($("#fixPriceMoney").val()!="" && $("#fixPriceMoney").val()>1000000){
				$.scojs_message("定价金额过大", $.scojs_message.TYPE_ERROR);
				return false;
			}
		}
		
		if($("#yuguMoney").val()!=0 && $("#yuguMoney").val()>1000000){
			$.scojs_message("预估金额过大", $.scojs_message.TYPE_ERROR);
			return false;
		}
		
		issubmit=true;
		
		//禁用按钮
		$("#create-order").attr("disabled",true);
		
		if($("input[name=check_drivers]:checked").length > 0){
			$.post('${ctx}/order/createAndPaidan',$("#submit_form").serialize(),function(result){
				if(result.success){
					window.close();
					window.opener.location.reload(true);
				}
				else{
					$.scojs_message(result.message, $.scojs_message.TYPE_ERROR);
					$("#create-order").attr("disabled",false);
				}
			});
		}
		else{
			$.post('${ctx}/order/create',$("#submit_form").serialize(),function(){
				window.close();
				window.opener.location.reload(true);
			});
		}
		
	});
	
	
	//根据客户手机获取信息
	$("#clientPhone").change(function(){
	    
		$.get('${ctx}/member/findByPhone',{'phone':$(this).val(),'couponType':'daijia'},function(data){
    		
			if(data.passenger!=null){
				$("#passengerId").val(data.passenger.id);
				$("#clientName").val(data.passenger.name);
				$("#clientVirtual").text(data.passenger.drawMoney+"元");
				$("#allcount").html(data.countAll);
				$("#allnotcancelcount").html(data.countAllNotCancel);
				$("#monthcount").html(data.countMonth);
				$("#monthnotcancelcount").html(data.countMonthNotCancel);
				
				$("#couponSelect").html("");
				if(null!=data.coupons && data.coupons.length>0){
    				var contentText="";
    					contentText+="<div class='input-group'>";
						contentText+="<div class='input-group-addon'>可用优惠券</div>";
						contentText+="<select class='form-control' multiple='multiple' id='couponIds' name='couponIds'/>";
		            	contentText+="</select>";
		            	contentText+="</div>";
	    			$("#couponSelect").append(contentText);
    				$(data.coupons).each(function(index,element){
		            	var text="<option value="+element.id+">"+element.couponRule.title+"</option>";
		            	$("#couponIds").append(text);
    				});
    				$('#couponIds').multiselect({
						enableFiltering: true,
					    includeSelectAllOption: true,
					    selectAllText: '全部',
					    selectAllJustVisible: true,
					    buttonWidth: '100%',
					    nonSelectedText: '请选择优惠券',
					    nSelectedText: ' - 已选择',
					    numberDisplayed: 5,
					    allSelectedText: '已选择全部'
					});
				}
				
				if(data.passenger.inBlackList){
					$("#membertype").html("黑名单");
				}else{
					$("#membertype").html(data.passenger.typeStr);
				}
				$("#todayordernums_div").slideDown();
				
				$("#companyId option").each(function(index,element){
				  	if($(element).attr("value")==data.passenger.companyId){
				 		$(element).attr("selected","selected");
				 		return false;
				 	}
				});
				
				$("#companyId").change();
				
			}
			else{
				$("#allcount").html(0);
				$("#allnotcancelcount").html(0);
				$("#monthcount").html(0);
				$("#monthnotcancelcount").html(0);
				$("#clientVirtual").text("0元");
				$("#membertype").html("新客户");
			}
				console.log(data);
			if(data.orderList && data.orderList.length>0){
				$(".memberOrders-tr").remove();
				$(data.orderList).each(function(index,element){
					var content="<tr class='memberOrders-tr'>";
					if(element.status==0){
						content+="<td><span class='label label-info'>新订单</span></td>";
					}
					else if(element.status==1){
						content+="<td><span class='label label-warning'>已派单</span></td>";
					}
					else{
						content+="<td><span class='label label-danger'>服务中</span></td>";
					}
					content+="<td><a target='_blank' href='${ctx}/order/detail/"+element.id+"'>***"+element.orderNumber.substring(8)+"</a></td>"+
							"<td>"+element.orderType+"</td>"+
							"<td>"+element.fromSource+"</td>"+
							"<td>"+element.serverTimeHI+"</td>"+
							"<td>"+element.fromPlace+"</td>"+
							"<tr>";
					$("#memberOrders-table tbody").append(content);
				});
				
				$("#memberOrders-table").show();
			}
			else{
				$("#memberOrders-table").hide();
			}
				
			var weixinManager=data.weixinManager;
			if(weixinManager!=null){
				if($("#clientName").val()==""){
					$("#clientName").val(weixinManager.name);
				}
					
				if($("#fromPlace").val()==""){
					$("#fromPlace").val(weixinManager.place);
					$("#longitude").val(weixinManager.longitude);
					$("#latitude").val(weixinManager.latitude);
					
					var point = new BMap.Point(weixinManager.longitude,weixinManager.latitude);  
					map.centerAndZoom(point, 12);
	    			map.enableScrollWheelZoom();
	    			var marker = new BMap.Marker(point);  // 创建标注
	    			map.clearOverlays();
	    			map.addOverlay(marker);
				}
			}
				
		});
	});
	
	//改变公司
	$("#companyId").change(function(){
		
		if($("#fromPlace").val()==""){
			var newCity=$("#companyId option:selected").attr("data-city");
			var myGeo = new BMap.Geocoder();
			myGeo.getPoint(newCity, function(point){ 
				if (point) {
					map.centerAndZoom(point, 13);
				    map.enableScrollWheelZoom();
				}
			});
		}
		
		
		$.get('${ctx}/weixinmanager/findOKByCompany',{'companyId':$(this).val()},function(data){
			if(null!=data &&　data.length>0){
				$("#weixinManagerId").html("");
				$("#weixinManagerId").append("<option value=''>--无--</option>");
				$(data).each(function(index,element){
					var content="<option value='"+element.id+"'>";
					
					content+=element.name;
					
					content+="</option>";
					
					$("#weixinManagerId").append(content);
				});
			}
			else{
				$("#weixinManagerId").html("");
				$("#weixinManagerId").append("<option value=''>--无--</option>");
			}
		});
	});
	
	$("#fixPrice").click(function(e){
		if(this.checked){
			$("#fixPrice_div").slideDown();
		}
		else{
			$("#fixPrice_div").slideUp();
		}
	});
	
	<#if default=="daijia">
	//回车监控
	document.onkeydown = function(e){ 
	    var ev = document.all ? window.event : e;
	    if(ev.keyCode==13) {
	    	$("#btn-position").click();
	    	$("#btn-deliverAddress").click();
	    }
	}
	</#if>


	//预约地自动补全
	$('#fromPlace').AutoComplete({
        'data': "${ctx}/order/getHistoryInputedPlace",
        'ajaxParams':function(keyword){
			return {'city':$("#companyId option:selected").attr("data-city")};
		},
		'ajaxDataType': 'json',
        'itemHeight': 24,
        'width': 'auto',
        'async': true,
        'listStyle': 'custom',
        'emphasis': false,
        'matchHandler': function(keyword, data){
            return true;
        },
        'createItemHandler': function(index, data){
        	if(data.address.length>14){
        		return "<span title='"+data.address+"'>"+data.address.substring(0,14)+"</span>";
        	}
            return "<span title='"+data.address+"'>"+data.address+"</span>";
        },
        'afterSelectedHandler': function(data){
        	$("#fromPlace").val(data.address);
        	
            map.clearOverlays();
            var oldPoint=new BMap.Point(data.longitude,data.latitude);
	   		var oldMarker = new BMap.Marker(oldPoint);
	   		map.centerAndZoom(oldPoint, 13);
			map.addOverlay(oldMarker);
            
            markerComplete(data.longitude,data.latitude);
            start_Point[0]=data.longitude;
	        start_Point[1]=data.latitude;
	        if(end_Point.length!=0){
	        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
				var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
				map.centerAndZoom(startPoint, 10); 
				driving2.search(startPoint, endPoint);
	        }
            
        }
    }).AutoComplete('show');
    
    $('#toPlace').AutoComplete({
        'data': "${ctx}/order/getHistoryInputedPlace",
        'ajaxParams':function(keyword){
			return {'city':$("#companyId option:selected").attr("data-city")};
		},
		'ajaxDataType': 'json',
        'itemHeight': 24,
        'width': 'auto',
        'async': true,
        'listStyle': 'custom',
        'emphasis': false,
        'matchHandler': function(keyword, data){
            return true;
        },
        'createItemHandler': function(index, data){
        	if(data.address.length>14){
        		return "<span title='"+data.address+"'>"+data.address.substring(0,14)+"</span>";
        	}
            return "<span title='"+data.address+"'>"+data.address+"</span>";
        },
        'afterSelectedHandler': function(data){
        	$("#toPlace").val(data.address);
        	
			map.clearOverlays();
            var oldPoint=new BMap.Point(data.longitude,data.latitude);
	   		var oldMarker = new BMap.Marker(oldPoint);
	   		map.centerAndZoom(oldPoint, 13);
			map.addOverlay(oldMarker);
			
			$("#toPlaceLongitude").val(data.longitude);
			$("#toPlaceLatitude").val(data.latitude);
			end_Point[0]=data.longitude;
	        end_Point[1]=data.latitude;
	        if(start_Point.length!=0){
	        	var startPoint=new BMap.Point(start_Point[0], start_Point[1]);
				var endPoint=new BMap.Point(end_Point[0],end_Point[1]);
				map.centerAndZoom(startPoint, 10); 
				driving2.search(startPoint, endPoint);
	        }
        }
    }).AutoComplete('show');
	
});	
//改变驾车路线回调
var markerComplete = function (lng,lat){
	$("#longitude").val(lng);
	$("#latitude").val(lat);
	//附近服务人员
    $.get('${ctx}/driver/listdistance',{'longitude':lng,'latitude':lat,'orderCarType':"daijia"},function(data){
    	$(".drivers-tr").remove();
		if(data && data.length>0){
			$(data).each(function(i,driver){
				var content="<tr class='drivers-tr'>"+
							"<td><input type='checkbox' name='check_drivers' value='"+driver.id+"' /></td>"+
							"<td>"+driver.realname+"</td>"+
							"<td>"+driver.distance+"</td>"+
							"<td>"+driver.todayOrders+"次</td>"+
							"<td>"+driver.monthOrders+"次</td>"+
							"<tr>";
				$("#drivers-table tbody").append(content);
			});
		}
	});
}
//订单定价
    $("#isMakePrice").click(function(e){
        if(this.checked){
            $("#isMakePrice").val("1");
            $("#makePrice_div").slideDown();
        }
        else{
            $("#isMakePrice").val("0");
            $("#makePrice_div").slideUp();
        }
    });

<!--关闭浏览器 -->  
var issubmit = false;
window.onbeforeunload = function () {
	if(!issubmit){
		return ("您确认要离开该页面吗?");
	}
}  

function getWeixinManagersContent(){
	var weixinManagersContent = "<option value=''>--无--</option>";
	<#list weixinManagers as weixinManager>
		weixinManagersContent+="<option value='${weixinManager.id}'>${weixinManager.name?if_exists}</option>";
	</#list>
//	$(weixinManagers).each(function(index,data){
//		areaContent+="<option value='"+data.id+"'>"+data.name+"</option>"
//	});
	return weixinManagersContent;
};
</script>

</body>
</html>
